// @ts-ignore
/* eslint-disable */


import {agentRequest, userRequest} from "@/utils/HttpRequest";
import {NodeData, OrgItem} from "@ant-design/charts";


export async function findByPageList(params?: any) {
  //SwaggerResources


  return userRequest<API.LoginLog> (
    "findByPageList", {
      method: "GET", params: {...params}
    } )


}

export async function findByPageBackAgentList(params?: any) {
  //SwaggerResources


  return userRequest<API.LoginLog> (
    "findByPageBackAgentList", {
      method: "GET", params: {...params}
    } )


}
export async function serachMiniByPhone(params?: any) {
  //SwaggerResources


  return new Promise<API.GlobalStatus[]> ( (resolve, reject) => {
    userRequest<API.BaseArrayDataResult<API.GlobalStatus>> (
      "serachMiniByPhone", {
        method: "GET", params: {phone:params?.keyWords}
      } ).then ( (res) => {
      //   console.log("category/findBySelectList",res)
      resolve ( res?.data )
    } ).catch ( (e => {
      reject ( e )
    }) )
  } )


}




export async function findByTreeList(userId: number) {
  //SwaggerResources

//OrgItem
  return userRequest<API.BaseDataResult<NodeData<OrgItem>>> (
    "findTreeList", {
      method: "GET", params: {userId: userId}
    } )


}


export async function findById(userId: number) {
  //SwaggerResources

//OrgItem
  return new Promise<API.Users> ( (resolve, reject) => {
    userRequest<API.BaseDataResult<API.Users>> (
      "findById", {
        method: "GET", params: {userId: userId}
      } ).then ( (response) => {
      resolve ( response?.data )
    } ).catch ( e => {
      reject ( e )
    } )
  } );


}

//findMyParentList
export async function findMyParentList(userId: number) {
  //SwaggerResources

//OrgItem
  return new Promise<API.Users[]> ( (resolve, reject) => {
    userRequest<API.BaseArrayDataResult<API.Users>> (
      "findMyParentList", {
        method: "GET", params: {userId: userId}
      } ).then ( (response) => {
      resolve ( response?.data )
    } ).catch ( e => {
      reject ( e )
    } )
  } );


}

export async function editWalletReChange(params: API.Users) {
  return userRequest<API.BaseResult> ( "wallet/backwithdrawal", {
    method: "POST",
    data: params
  } )
}

export async function editIntegralReChange(params: API.Users) {
  return userRequest<API.BaseResult> ( "wallet/backIntegral", {
    method: "POST",
    data: params
  } )
}

export async function editUsers(params: API.Users) {
  return userRequest<API.BaseResult> ( "edit", {
    method: "POST",
    data: params
  } )
}
export async function editUsersReg(params: API.Users) {
  return userRequest<API.BaseResult> ( "editReg", {
    method: "POST",
    data: params
  } )
}

export async function editAgentUpdate(params: API.Users) {
  return userRequest<API.BaseResult> ( "editAgentUpdate", {
    method: "POST",
    data: params
  } )
}

export async function brackReUpdate(params: { type: number, state: number, id: number }) {
  return userRequest<API.BaseResult> ( "brackUpdate", {
    method: "POST",
    data: params
  } )
}





